package com.ideaplugin.datamanager.common;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

@Configuration
@EnableOpenApi
public class SwaggerConfig {
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .enable(true)
                .groupName("zjb")
                .select()
                //.apis(RequestHandlerSelectors.basePackage("com.ideaplugin.datamanager"))
                .apis(RequestHandlerSelectors.withClassAnnotation(SwaggerScan.class))
                .build();
    }


    @SuppressWarnings("all")
    public ApiInfo apiInfo() {
        return new ApiInfo(
                "数据管理系统",
                "啥？数据库加了一张表，还得写一个页面来curd ，太慢了，本系统无需新增页面，即可对数据进行管理，一个低代码的数据管理系统，你值得拥有",
                "v1.0",
                "zjbhnay@163.com", //开发者团队的邮箱
                new Contact("赵静波", "https://www.ideaplugin.com", "zjbhnay@163.com"),
                "Apache 2.0",  //许可证
                "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList<>()//许可证链接

        );
    }
}